package com.example.WeChat.Config.RedisConfig;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.JedisShardInfo;
import redis.clients.jedis.ShardedJedisPool;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class RedisConfig {

    @Bean
    public ShardedJedisPool shardedJedisPool() {
        JedisPoolConfig poolConfig = new JedisPoolConfig();
        // 设置 Jedis 连接池的配置，如最大连接数、最大空闲连接数等

        // 创建多个 Jedis 分片信息
        List<JedisShardInfo> shards = new ArrayList<>();
        // 添加多个分片信息，如主从或哨兵模式

        return new ShardedJedisPool(poolConfig, shards);
    }
}

